<template>
  <u-form-grid :data="formGrid"></u-form-grid>
</template>

<script>
  import values from '../../utils/values'

  export default {
    name: 'Customers',
    data() {
      return {
        formGrid: {
          options: {
            version: 'v2',
            url: {
              page: "/customers/invoices/page",
              save: "/customers/invoices/save",//记录添加和修改提交的地址，如果提交的对象有id则为修改
              delete: "/customers/invoices/delete",//记录删除的提交地址，通过提交id的集合来实现一个或者多个记录
              get: "/customers/invoices/find",//查看和编辑时用于查询对象的接口，参数为定义的keys
            }
          },
          tips: {"title": "收藏管理", "content": "FormGrid是一个结合表单查询、修改、删除等全功能的组件。方便快速实现CRUD功能!"},
          form: {
            modal: {
              title: "首层信息"
            },
            columns: [
              {label: "所属客户", type: "text", name: "customerId", required: false},
              {label: "发票类型", type: "select", name: "invoiceType", required: true, data: values.invoiceType},
              {label: "抬头", type: "text", name: "titleName", required: true},
              {label: "开户银行", type: "text", name: "depositBank", required: false,},
              {label: "公司地址", type: "text", name: "companyAddress", required: false},
              {label: "账号", type: "text", name: "accountNo", required: false},
              {label: "税号", type: "text", name: "taxFileNumber", required: false},
              {label: "是否默认", type: "select", name: "defaultInvoice", required: false, data: values.bool},
            ]
          },
          toolbar:{
            delete: { show :false },
            create: { show :false },
          },
          table: {
            operation: {
              //调用查看、编辑、删除接口时，需要传递的参数主键名称，可以有多个。默认为id
              primaryKey: "id",
              buttons: [
              ]
            },
            columns: [
              {title: '所属客户', key: 'customerNickname'},
              {title: '商品编号', key: 'sn'},
              {title: '商品名称', key: 'name'},
              {title: '品牌名称', key: 'brandName'},
              {title: '所属分类名称', key: 'categoryName'},
              {title: '商品主图地址', key: 'mainImgUrl'},
              {title: '商品原始价格', key: 'originalPrice'},
              {title: '商品类型', key: 'goodsType'},
              {title: '是否上架', key: 'marketable'},
              {title: '是否为赠品', key: 'gift'},
            ]
          }
        }
      }
    },
    methods: {}
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
